
//其他下载分页查询
function otherReload(page) {
	var data_param = {
		downloadId: $("#downloadId").val(),
		page : page
	};
	$.ajax({
		type:"POST",
		url:"/download/ajaxPage",
		data:data_param,
		async:false,
		dataType:"json",
		success:function(data){
			$('#page').val(data.page);
			$('#pageCount').val(data.pageCount);
			
			//其他下载产品查询
			var other = '';
			$("#other").empty();
			$.each(data.dpVos,function(index,dpv){
				if(data.dpVos.length > 0) {
					other += '<div class="phodown_mok">'+
							 '<div class="img_con"><img src="'+dpv.product.productImg+'"></div>'+
						     '<div class="text_con">'+
						     '<h3>'+dpv.product.productName+'</h3>'+
						     '<p>'+dpv.product.productBrief+'</p>'+
						     '<div class="btn_con">';
					
					$.each(dpv.pdv,function(index1,pdv){
						other += '<div class="pc">'+
						      '<a href="#" class="mfxz_btn btn"><i class="icon"></i><span>'+pdv.downloadWayName+'</span></a>'+
						      '</div>';
					})
					
					other += '</div></div></div>';
				}
				
			})
			other +='<div class="page mt20" align="center">共'+data.totalRows+'条记录 '+data.page+'/'+data.pageCount+'页&nbsp;'+
					'<a disabled="disabled" href="javascript:otherReload(1)">首页</a> <a disabled="disabled" onclick="javascript:ajaxPageUp('+data.page+')">上一页</a>&nbsp;'+
					'<a href="#" onclick="return ajaxPageDown('+data.page+');">下一页</a>&nbsp;'+
					'<a href="javascript:otherReload('+data.pageCount+')" >尾页</a>&nbsp; 第&nbsp;'+
					'<select onchange="ajax2Page()" id="currPage">';
			for(var i = 1; i <= data.pageCount; i++) {
				other += '<option value="'+i+'" ';
				if(data.page == i) {
					other += 'selected="selected"';
				}
				other += '>'+i+'</option>';
			}
			other += '</select>&nbsp;页</div>';		
			$("#other").append(other);
			
		}
	})
}

function ajax2Page() {
	otherReload($('#currPage').val());
}

//向上翻页
function ajaxPageUp(page) {
	if(page == 1) {
		BSTYUN.dialog.ok("已经是第一页");
		return;
	}else {
		var num = parseInt(page) - 1;
		otherReload(num);
	}
}

//向下翻页
function ajaxPageDown(page) {
	if(page == $("#pageCount").val()) {
		BSTYUN.dialog.ok("已经是最后一页");
	}else {
		var num = parseInt(page) + 1;
		otherReload(num);
	}
	return false;
}
